package com.tledu.homework;

import java.util.HashSet;

public class Homework {
    // 通过HashSet存储Student数据，要求，学生只要是学号重复就是重复数据，不会再HashSet出现两个学号一样的学生（equals、hasCode）
    public static void main(String[] args) {
        Student a = new Student(11,"张三");
        Student b = new Student(11,"张三");
        Student c = new Student(11,"张三");
        Student d = new Student(12,"李四");
        Student e = new Student(13,"王五");
        HashSet<Student> set = new HashSet<>();
        set.add(a);
        set.add(b);
        set.add(c);
        set.add(d);
        set.add(e);
        for (Student stu : set) {
            System.out.println("学号:"+stu.getStudentNum()+",姓名："+stu.getName());
        }
    }
}
